package com.intelligencesoft.pss.entity.base;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.GenericGenerator;

import com.intelligencesoft.pss.entity.BasePojo;

/**
 * 用户信息
 * @author HuangYinglu
 * @date: 2014-8-21-下午6:20:54
 */
@Entity
@Table(name="T_USER_INFO")
public class UserInfo extends BasePojo{

	private static final long serialVersionUID = -6105449190776425762L;
	
	private String realName;
	
	private String userName;
	
	private String mobilePhone;
	
	private String password;
	
	private String email;
	
	public UserInfo() {}
	
	public UserInfo(String userName, String password) {
		super();
		this.userName = userName;
		this.password = password;
	}

	@Id
	@Column(name = "C_ID", nullable = false, length = 32)
	@GeneratedValue(generator = "system-uuid")
	@GenericGenerator(name = "system-uuid", strategy = "uuid")
	public String getId() {
		return super.getId();
	}
	
	public void setId(String id) {
		super.setId(id);
	}
	
	@Column(name="C_CREATE_DATE")
	@Temporal(value=TemporalType.TIMESTAMP)
	public Date getCreateDate() {
		return super.getCreateDate();
	}
	public void setCreateDate(Date createDate) {
		super.setCreateDate(createDate);
	}
	
	@Column(name="C_REAL_NAME")
	public String getRealName() {
		return realName;
	}

	public void setRealName(String realName) {
		this.realName = realName;
	}

	@Column(name="C_USER_NAME")
	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	@Column(name="C_MOBILE_PHONE")
	public String getMobilePhone() {
		return mobilePhone;
	}

	public void setMobilePhone(String mobilePhone) {
		this.mobilePhone = mobilePhone;
	}

	@Column(name="C_PASSWORD")
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	@Column(name="C_EMAIL")
	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	
	public String toInfoString() {
		StringBuffer buffer=new StringBuffer("{\"id\":\"");
		buffer.append(getId());
		buffer.append("\",\"email\":\"");
		buffer.append(getEmail());
		buffer.append("\",\"mobilePhone\":\"");
		buffer.append(getMobilePhone());
		buffer.append("\",\"realName\":\"");
		buffer.append(getRealName());
		buffer.append("\",\"userName\":\"");
		buffer.append(getUserName());
		buffer.append("\"}");
		return buffer.toString();
	}
}
